import React, { useMemo } from 'react';
import { Input } from 'antd';
import { INodeComponent } from './type';

export const NodeTextArea: React.FC<INodeComponent> = (props) => {
  const data = useMemo(() => {
    return props?.data;
  }, [props?.data, props.value]);

  const onInputChange = (e: any) => {
    if (e && props?.onChange) {
      props.onChange(e?.target?.value);
    }
  };

  return (
    <>
      <Input.TextArea
        // readOnly
        placeholder={`请填写${data.labelName}`}
        onChange={onInputChange}
        title={`请填写${data.labelName}`}
        value={props.value ?? ''}
      />
    </>
  );
};
